from abc import ABC, abstractmethod



class PLCClientInterface(ABC): # 规范子类需要遵循的公共接口
    @abstractmethod
    def connect(self):
        """
        这是一个抽象方法，子类必须实现。
        """
        pass
    @abstractmethod
    def get_connected(self):
        """
        这是一个抽象方法，子类必须实现。
        """
        pass

    @abstractmethod
    def read_int8(self, start=0, size=1) -> int:
        pass

    @abstractmethod
    def read_int16(self, start=0, size=2) -> int:  # 读int16
        pass

    @abstractmethod
    def read_bool(self, start=0, size=1) -> int: # 读bool
        pass

    @abstractmethod
    def read_real(self, start=0, size=4) -> float: # 读实数
        pass

    @abstractmethod
    def write_int8(self, start=0, data_int8=0): # 写int8
        pass

    @abstractmethod
    def write_int16(self, start=0, data_int16=0):  # 写int16
        pass

    @abstractmethod
    def write_real(self, start=0, data_real=1.0): # 写实数  用于发送坐标等
        pass

    @abstractmethod
    def write_bool(self, start=0, data_bool=False): # 写bool
        pass

    @abstractmethod
    def read_string(self, start=0, size=50, dbnumber=0) -> str: # 读 string  size=256
        pass

    @abstractmethod
    def write_string(self, start=0, data_str='hello', dbnumber=0): # write string
        pass

    @abstractmethod
    def close(self):
        pass